
export enum QrCodeStatus {
    UN_SCAN = 0, // 未扫码状态
    CODE_INVALIDATE = 1, // 二维码已失效
    SCANED = 2, // 已扫码状态
    USER_CANCEL = 3,//用户取消扫码登录
    USER_CONFIRM = 4, // 用户确认扫码登陆
}

export class QrcodeContext {
    channelId: string;
    expTimes: number;
    status: number;
    token?: string;

    constructor(channel: string, expTimes: number, status: number = 0) {
        this.channelId = channel;
        this.status = status;
        this.expTimes = expTimes;
    }

    isExpire(): boolean {
        return this.expTimes < Date.now();
    }

    changeStatus(codeStatus: QrCodeStatus) {
        this.status = codeStatus;
    }
}